/*
 * @Author: caiqi
 * @Date: 2019-02-14 14:34:34
 * @Last Modified by: cai.qi
 * @Last Modified time: 2020-05-13 18:22:17
 * @Describe:
 */

"use strict";

import { Service } from "egg";

export default class TypeService extends Service {
    // ------------------------------ create
    async create(body: any) {
        const { ctx } = this;
        const _data = await ctx.model.ModUser.findOne({ where: { openid: body.openid, status: 1 } });

        if (_data) {
            return { data: _data };
        }
        
        const data = await ctx.model.ModUser.create(body);
        return { data };
    }
}
